# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-ascii_graph
pkgname=('python2-ascii_graph' 'python-ascii_graph')
_pkgname='ascii_graph'
pkgver=1.5.2
pkgrel=1
pkgdesc='A simple python lib to print data as ascii histograms.'
arch=('any')
url='https://pypi.python.org/pypi/ascii_graph/'
license=('MIT')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('9cdcb7c715631740e5e76bb2bcc2790db3671d3e60c63acb31989523438480906ac19374f0fc2953d96d12530867c36edbd97bbe0234972f5172687c0aefa95a')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-ascii_graph() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build

  mv "$pkgdir/usr/bin/asciigraph" "$pkgdir/usr/bin/asciigraph2"
}

package_python-ascii_graph() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

